package controller

import "github.com/gin-gonic/gin"

type SuccessMessage struct {
	Code    int         `json:"code"`
	Message interface{} `json:"message"`
	Data    interface{} `json:"data"`
}

type FailedMessage struct {
	Code    int         `json:"code"`
	Message interface{} `json:"message"`
}

func ReturnSuccess(ctx *gin.Context, code int, message interface{}, data interface{}) {
	json := &SuccessMessage{Code: code, Message: message, Data: data}
	ctx.JSON(200, json)
}

func ReturnFailed(ctx *gin.Context, code int, message interface{}) {
	json := &FailedMessage{Code: code, Message: message}
	ctx.JSON(404, json)
}
